home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 1 / Gold Medal Software Volume 1 (Gold Medal) (1994).iso / prog / dasv10_.arj / RUNME.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-10  |  1.6 KB  |  89 lines

  1. #include <graphics.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <conio.h>
  5. #include <dos.h>
  6.  
  7. // POOF! v1.0 programmed by David A. Scouten
  8. // for 1993 WDM Software Publications
  9.  
  10. // prototype definition(s)
  11. void airbag(void);
  12. void wdmlogo(void);
  13. void syscrash(void);
  14.  
  15. void main() { //start main function
  16. int count=5;
  17.  
  18. // request auto detection
  19. int gdriver = DETECT, gmode, errorcode;
  20.  
  21. // initialize graphics mode
  22. initgraph(&gdriver, &gmode, "egavga.bgi");
  23.  
  24. //read result of initialization
  25. errorcode = graphresult();
  26.  
  27. if (errorcode != grOk) { //an error occurred
  28.     printf("Graphics error: %s\n", grapherrormsg(errorcode));
  29.     printf("Press any key to halt:");
  30.     getch();
  31.     }
  32.     else
  33.     { // actual program begins
  34.  
  35. printf("\n\t\t\t\tCountdown\n\t\t");
  36. while (count!=-1) {
  37. printf("%d\t",count);
  38. delay(1000);
  39. count--;
  40. }
  41.  
  42. printf("\n\n\n\n\t\t\tAir Bag device activated!!");
  43. delay(2500);
  44.  
  45. cleardevice();
  46. airbag();
  47. wdmlogo();
  48. syscrash();
  49.  
  50.     // clean up
  51.     getch();
  52.     closegraph();
  53.     }
  54. }// end main function
  55.  
  56. // function airbag
  57. void airbag(void) {
  58. int num, xpos=320, ypos=235;
  59. setbkcolor(RED);
  60.         for (num=50;num<=250;num+=20) {
  61.             setcolor(WHITE);
  62.             fillellipse(xpos,ypos,num,num);
  63.             sound(num);
  64.         setcolor(LIGHTGREEN);
  65.         outtextxy(xpos-15,ypos,"POOF!!");
  66.         }
  67. nosound();
  68. }// end airbag
  69.  
  70. // function wdmlogo
  71. void wdmlogo(void) {
  72. int xpos=320, ypos=235;
  73. setcolor(LIGHTBLUE);
  74. outtextxy(xpos-115,ypos+230,"1993 WDM Software Publications");
  75. }// end wdmlogo
  76.  
  77. // function syscrash
  78. void syscrash(void) {
  79. int colr;
  80. LOOP:
  81.  
  82.     for (colr=0;colr<=15;colr++) {
  83.         setbkcolor(colr);
  84.         delay(10);
  85.     }
  86.  
  87. goto LOOP;
  88.  
  89. } // end syscrash